﻿using Idte.Common.Patterns;
using Idte.Core.Infrastructure.Repository;
using System;
using System.Collections.Generic;
using System.ComponentModel.DataAnnotations.Schema;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

namespace Idte.Common.Process
{
    public abstract class ProcessDescriptor<TChild> : StepDescriptor, IProcessDescriptor<TChild>, IComposite<TChild>, INamed where TChild : IStepDescriptor
    {
        public ICollection<TChild> Steps { get; set; }
        
        [NotMapped]
        public ICollection<TChild> Children
        {
            get { return Steps; }
            set { Steps = value; }
        }

        public void Add(TChild step)
        {
            Steps.Add(step);
        }

        public bool Remove(TChild step)
        {
            return Steps.Remove(step);
        }
    }

}
